package com.jtny.nytb.dataparam.service;

import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.github.xiaoymin.knife4j.annotations.ApiSort;
import com.jtny.component.entity.PageData;
import com.jtny.component.exception.ServiceException;
import com.jtny.nytb.config.coderule.dto.ConfigRuleManagementDTO;
import com.jtny.nytb.config.coderule.dto.ConfigRuleManagementPageDTO;
import com.jtny.nytb.config.dictionary.dto.DictionaryInfoDTO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Api(value = "单据编号规则管理接口", tags = "单据编号规则管理接口")
@ApiSort(202301)
@Service
public interface ConfigRuleManagementService {

    /**
     * 保存规则管理数据
     * @param configRuleManagementDTO
     * @return
     */
    @ApiOperation("保存单据编号规则管理信息")
    ConfigRuleManagementDTO save(@RequestBody ConfigRuleManagementDTO configRuleManagementDTO) throws ServiceException;

    @ApiOperation("通过id获取单据规则数据")
    ConfigRuleManagementDTO queryById(@PathVariable("ruleId") Long ruleId);

    @ApiOperation("更新单据编号规则数据")
    ConfigRuleManagementDTO update(@RequestBody ConfigRuleManagementDTO configRuleManagementDTO) throws ServiceException;

    @ApiOperation("删除id获取单据规则数据")
    ConfigRuleManagementDTO delete(@PathVariable("ruleId") Long ruleId);

    @ApiOperation("分页查询单据编号规则")
    PageData<ConfigRuleManagementDTO> queryPage(@RequestBody ConfigRuleManagementPageDTO configRuleManagementPageDTO);

    @ApiOperation("通过code获取单据规则数据")
    ConfigRuleManagementDTO queryBycode(@PathVariable("code") String code);

    @ApiOperation("获取最新的规则")
    ConfigRuleManagementDTO queryLast();

    @ApiOperation("生成一条新编码")
    String queryCodeBycode(@RequestParam(value = "code", required = false) String code, @RequestParam(value = "superiorCode", required = false)String superiorCode);

    @ApiOperation("根据名称查询是否存在")
    List<String> existCodeRuleByName(@RequestBody List<String> nameList);

    @ApiOperation("批量保存")
    Boolean saveBatchCodeRule(@RequestBody List<ConfigRuleManagementDTO> toSaveList);
}

